

use "$temp/simulated_data_baseline_combined", clear
ren v1 uniqid
ren v2 year
ren v3 mu
ren v4 e
ren v5 m
ren v6 p
ren v7 l
ren v8 age
ren v9 x
ren v10 ac
ren v11 f
ren v12 lp_type
ren v13 h
ren v14 wage
ren v15 l_prime
ren v16 sim
ren v17 age_int
ren v21 tau
ren v22 util
//cap gen v23 = 0
ren v23 util_start
ren v24 race
replace util_start = util_start/44





//analysis of starting location

gen mig = (l_prime<11)
bys uniqid sim: egen mig_ever = max(mig)
drop mig

gen mig_parent = (l_prime == 1) //move to parent location
bys uniqid sim: egen mig_parent_ever = max(mig_parent)
drop mig_parent

gen temp = l if age_int == 22 & e == 1
replace temp = l if age_int == 25 & e==2
bys uniqid sim: egen l_start = max(temp)
//drop temp
//keep if (age_int == 22 & e == 1 | age_int == 25 & e == 2)
gen start_away = (l_start!=1)

tab mig_ever
tab mig_parent_ever
tab start_away


cap log close
log using "$output/Table_A11", replace
tab mu
tab mu if !mig_ever
tab mu if mig_ever
tab mu if start_away
log close